<?xml version="1.0" encoding="UTF-8"?>
<html><head><title>Strict Java Mode</title></head><body bgcolor="ffffff"><table cellspacing="10"><tr><td align="center"><a href="http://www.beanshell.org/"><img src="../images/homebutton.gif"/><br/>Home</a></td><td><a href="commands.html#Adding_BeanShell_Commands"><img src="../images/backbutton.gif"/><br/>Back
			</a></td><td align="center"><a href="contents.html"><img src="../images/upbutton.gif"/><br/>Contents</a></td><td align="center"><a href="classpath.html#Class_Loading_and_Class_Path_Management"><img src="../images/forwardbutton.gif"/><br/>Next
			</a></td></tr></table><h1>Strict Java Mode</h1>


<em>Note: Strict Java Mode is new and currently breaks some BeanShell tools
and APIs when activated.  The GUI desktop and most BeanShell commands 
will not work with strict Java mode enabled.  
Please see notes at the end of this page</em>
<p CLEAR="ALL"/>

If you are a Java teacher or a student learning the Java language and
you would like to avoid any potential confusion relating to BeanShell's
use of loose variable types, you can turn on Strict Java Mode.  Strict
Java Mode is enabled with the the setStrictJava() command.

When strict Java mode is enabled BeanShell will require typed variable
declarations, method arguments and return types.

For example:
<p/><center><table border="1" cellpadding="5" width="100%"><tr><td bgcolor="#dfdfdc"><pre>
setStrictJava(true);

int a = 5;

foo=42; // Error! Undeclared variable 'foo'.

bar() { .. } // Error! No declared return type.
</pre></td></tr></table></center><p/>


<table cellspacing="10"><tr><td align="center"><a href="http://www.beanshell.org/"><img src="../images/homebutton.gif"/><br/>Home</a></td><td><a href="commands.html#Adding_BeanShell_Commands"><img src="../images/backbutton.gif"/><br/>Back
			</a></td><td align="center"><a href="contents.html"><img src="../images/upbutton.gif"/><br/>Contents</a></td><td align="center"><a href="classpath.html#Class_Loading_and_Class_Path_Management"><img src="../images/forwardbutton.gif"/><br/>Next
			</a></td></tr></table></body></html>